/*****************************************************************************
 *
 *                      HUSONG PROPRIETARY INFORMATION
 *
 *          The information contained herein is proprietary to HUSONG
 *           and shall not be reproduced or disclosed in whole or in part
 *                    or used for any design or manufacture
 *              without direct written authorization from HUSONG.
 *
 *            Copyright (c) 2015 by HUSONG.  All rights reserved.
 *
 *****************************************************************************/
package me.send.data.service.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import me.send.business.base.Pager;
import me.send.data.service.mapper.CityMapper;
import me.send.data.service.pojo.City;
import me.send.data.service.pojo.CityBean;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author maxmin
 *
 * @date 2015年9月25日 上午11:33:39
 */
@Service
public class CityService {
	
	@Autowired
	CityMapper cityMapper;
	
	public List<City> getCitiesList(){
		return cityMapper.getCitiesList(); 
	}
	public List<City> getOpenCitiesList(){
		return cityMapper.getOpenCitiesList(); 
	}
	
	public List<CityBean> list(String name,String letter,Integer status,String start,String end,Pager page){
		Map<String, Object> parameter = new HashMap<String, Object>();
    	parameter.put("name", name);
    	parameter.put("letter", letter);
    	parameter.put("status", status);
    	parameter.put("start", start);
    	parameter.put("end", end);
    	parameter.put("page", page);
    	List<CityBean> rows = cityMapper.list(parameter);
    	return rows;
	}
	
	public Integer count(String name,String letter,Integer status,String start,String end){
		Map<String, Object> parameter = new HashMap<String, Object>();
		parameter.put("name", name);
		parameter.put("letter", letter);
		parameter.put("status", status);
		parameter.put("start", start);
		parameter.put("end", end);
		Integer rows = cityMapper.count(parameter);
		return rows;
	}
	
	public void updateStatus(int opencityid,int status){
		Map<String, Object> parameter = new HashMap<String, Object>();
		parameter.put("opencityid", opencityid);
		parameter.put("status", status);
		cityMapper.updateStatus(parameter);
	}
}
